import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import showdown from "showdown";
import qs from "qs";

//加载mavon-editor 用于写markdown文本 加入笔记
import mavonEditor from "mavon-editor";
import "mavon-editor/dist/css/index.css";
Vue.use(mavonEditor);
Vue.component("md", mavonEditor);

// 设置md文件转html格式 showdown
Vue.prototype.md2html = (md) => {
  let converter = new showdown.Converter();
  let text = md.toString();
  let html = converter.makeHtml(text);
  return html;
};

// axios设置 axios
import axios from "axios";
// axios.defaults.baseURL = "http://127.0.0.1:3000";
// axios.defaults.baseURL = "http://blogserver.vaiwan.com";
Vue.prototype.axios = axios;

// 加载qs 方便axios post可以使用对象形式传递参数
Vue.prototype.qs = qs;

// 加载bootstrap css文件
import "@/assets/bootstrap.css";

// 自定义组件
// 网页头部
import header from "@/components/header";
Vue.component("myHeader", header);
// 单个文章item
import list from "@/components/list";
Vue.component("list", list);

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
